<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>菜单配置</title>
    <link rel="stylesheet" type="text/css" href="/static/common/js/dist/vue.css">
    <link rel="stylesheet" type="text/css" href="/static/admin/css/frame.css">
</head>
<body>
<div id="frame_top">
    当前位置&nbsp;<i class="iconfont" style="color:#666;font-size: 12px;">&#xe60e;</i>&nbsp;&nbsp;设置&nbsp;&nbsp;<i class="iconfont" style="color:#666;font-size: 12px;">&#xe60f;</i>&nbsp;&nbsp;站长设置&nbsp;&nbsp;<i class="iconfont" style="color:#666;font-size: 12px;">&#xe60f;</i>&nbsp;&nbsp;菜单设置
</div>
<div id="frame_toolbar">
    <ul>
        <li><a class="active" href="/intendant/Site/menu"><i class="iconfont" style="color:white;font-size: 14px;">&#xe611;</i>&nbsp;菜单设置</a></li>
        <li><a href="/intendant/Site/addEditMenu"><i class="iconfont" style="color:white;font-size: 14px;">&#xe610;</i>&nbsp;&nbsp;添加菜单</a></li>
        <li><a id="export" class="bsn" title="菜单导出的位置是C盘/用户/当前系统用户/下载" href="/intendant/Site/exportMenu"><i class="iconfont" style="color:white;font-size: 14px;">&#xe611;</i>&nbsp;导出菜单</a></li>
        <li><a id="import" href="/intendant/Site/importMenu"><i class="iconfont" style="color:white;font-size: 14px;">&#xe611;</i>&nbsp;导入菜单</a></li>
    </ul>
</div>
<div id="frame_content">
<form name="commonSort" class="ajax-form" action="/admin/site/sortmenu" method="post">
    <div class="frame_table_list" style="margin-top:85px;">
        <table id="example-advanced" width="100%">
            <colgroup>
                <col width="60">
                <col width="60">
                <col width="240">
                <col width="180">
                <col width="160">
            </colgroup>
            <thead>
              <tr>
                <th align="center">排序</th>
                <th align="center">ID</th>
                <th align="left" style="text-indent:30px;">菜单名</th>
                <th align="center">显示菜单</th>
                <th align="center">Url地址</th>
                <th align="center">管理操作</th>

              </tr>
            </thead>
            {{range .json}}
            <tr data-tt-id="{{.Id}}" {{if eq .Pid 0}}{{else}}data-tt-parent-id="{{.Pid}}"{{end}}>
                <td align="center"><input style="text-align: center" name="{{.Id}}" type="text" size="3" value="{{.Sort}}" class="input"></td>
                <td align="center">{{.Id}}</td>
                <td style="text-indent:25px;"><i class="iconfont" style="color:#666;font-size: 14px;">&#xe600;</i>&nbsp;&nbsp;{{.Name}}</td>
                <td align="center">{{if eq .Isshow 1}}<i class="iconfont" style="color:green;font-size: 16px;">&#xe60c;</i>{{else}}<i class="iconfont" style="color:red;font-size: 16px;">&#xe60a;</i>{{end}}</td>
                <td align="center">{{.Url}}</td>
                <td align="center"><a class="ajax-add blue" href="/Intendant/Site/addEditMenu/?pid={$menu['id']}" data-level="{{.Level}}"><i class="iconfont" style="color:white;font-size: 16px;">&#xe610;</i>&nbsp;&nbsp;添加子菜单</a>&nbsp;&nbsp;&nbsp;<a class="ajax-edit blue" href="/Intendant/Site/addEditMenu/?id={$menu['id']}"><i class="iconfont" style="color:white;font-size: 16px;">&#xe615;</i>&nbsp;&nbsp;修改</a>&nbsp;&nbsp;&nbsp;<a class="ajax-del red" data-title="{$menu['title']}" data-type="菜单" href="/Intendant/Site/delMenu" data-id="{$menu['id']}"><i class="iconfont" style="color:white;font-size: 16px;">&#xe614;</i>&nbsp;&nbsp;删除</a> </td>
            </tr>
            {{end}}
        </table>
    </div>
    <div class="frame_table_btn">
        <button class="btn ajax-sort" type="submit">排序</button>
        <!-- <a href="#" onclick="jQuery('#example-advanced').treetable('collapseAll'); return false;">Collapse all</a> -->
        <button class="btn" type="submit"
        onclick="$('#example-advanced').treetable('expandAll'); return false;">展开</button>
        <button class="btn" type="submit"
        onclick="$('#example-advanced').treetable('collapseAll'); return false;">折叠</button>
    </div>
</form>
</div>
</body>
<script src="/static/common/js/dist/jquery-1.12.3.min.js"></script>
<script src="/static/common/js/treetable/jquery.treetable.js"></script>
<script src="/static/common/js/layer/layer.js"></script>
<script src="/static/admin/js/admin.common.js"></script>
<script src="/static/admin/js/common.ajax.js"></script>
<script>
var option = {
    expandable: true,
    expandLevel : 3,
    column:2, //节点按钮在第几个栏位
}
$("#example-advanced").treetable(option);
$('.ajax-add').on('click', function (e) {
    var data = $(this).attr('data-level');
    if(data >= 3){e.preventDefault();admin.alert('提示信息','对不起，菜单最多4级！',2,'3000');}
});
</script>
</html>
